package com.sz.freemusic.net;

import com.sz.freemusic.common.ApplicationData;

public class RequestBuilder {
	
	private static final String ARTISTS_JSON = "artists.json";
	
	private static final String APP_KEY_PARAM = "api_key";
	
	
	public String getArtistListsRequest(int page) {
		
		StringBuilder sb = new StringBuilder();
		sb.append(ApplicationData.getInstance().getApiURL());
		sb.append(ARTISTS_JSON);
		sb.append('?');
		appendParameter(sb, APP_KEY_PARAM, ApplicationData.getInstance().getAppKey());
		if (page > 0) {
			sb.append("&page=");
			sb.append(page);
		}
		return sb.toString();
	}
	
	private void appendParameter(StringBuilder sb, String paramName, String paramValue) {
		sb.append(paramName);
		sb.append('=');
		sb.append(paramValue);
	}
}
